﻿using System;
using DesignPatterns.BuilderPattern.Config;
using DesignPatterns.BuilderPattern.Core;
using DesignPatterns.BuilderPattern.Repositories;

namespace DesignPatterns.BuilderPattern
{
    class Program
    {
        static void Main(string[] args)
        {
            var objectFactory = new ObjectFactory(new DependencyInjectionConfig());
            var personRepository = objectFactory.Get<IPersonRepository>();

            var person = personRepository.GetById(1);

            Console.WriteLine("These came from the person repository");
            Console.WriteLine("{0} {1}", person.FirstName, person.LastName);

            Console.WriteLine("\nThese came from the AddressRepository");
            person.Addresses.ForEach(Console.WriteLine);
            
            Console.WriteLine("\nThese came from the PhoneNumberRepository");
            person.PhoneNumbers.ForEach(Console.WriteLine);
            
            Console.WriteLine("\nThese came from the WebsiteRepository");
            person.FavoriteWebSites.ForEach(Console.WriteLine);

            Console.ReadLine();
        }
    }
}
